<?php 
@session_start();
require_once('../config/config.php');
require_once('../utils/CommonUtils.php');
require_once('../utils/DBUtils.php');
include ("../utils/Constants.php");
require_once('../utils/BaseDAO.php');
require("../utils/Session.php");
require_once('../utils/Pager.php');

$userid = Session::get('userid');

$commonUtils = new CommonUtils();
$pager = new Pager();

$page = $commonUtils->getParameter("p", 1);
$sortExpression = $commonUtils->getParameter("s", "ct.createddate");
$sortDirection = $commonUtils->getParameter("d", "desc");

$contentId = $commonUtils->getParameter("id", 0);
$baseDAO = new BaseDAO();
$youtubes = $baseDAO->getItems("youtube", array("id", "src", "title", "createddate", "createdby"), "status=1", "order by createddate desc", ($page - 1) * $videoPageSize, $videoPageSize);
$totalItems = $baseDAO->getTotalItems("youtube", "1");
?>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<LINK REL="SHORTCUT ICON" HREF="../img/fm.ico"> 
		<title>Nguyễn Đậu - Video</title>
		<link rel="stylesheet" type="text/css" href="../css/style.css"/>
		<link rel="stylesheet" type="text/css" href="../css/jquery.alert.css"/>
		<link rel="stylesheet" type="text/css" href="../css/jquery.fancybox.css"/>
		<link href="../css/bootstrap.css" rel="stylesheet">
		<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="../js/jquery.hind.js"></script>
		<script type="text/javascript" src="../js/jquery.fancybox.js"></script>
		<script type="text/javascript" src="../js/jquery.corner.js"></script>
		<script src="../js/jquery.alerts.js"></script>
		<script src="../js/bootstrap.min.js"></script>
	</head>
	<body>
		<div id="content">
			<?php include '../include/webheader.php';?>
			<div id="page">
				<?php foreach ($youtubes as $youtube){?>
					<div class="span6 well" style="margin-left:5px;width:430px;float:left;">
						<div id="title" class="title"><?php echo $youtube['title'];?></div>
						<iframe width="432" height="315" src="<?php echo $youtube['src'];?>" frameborder="0" allowfullscreen></iframe>
					</div>
				<?php }?>
				<div style="clear:both"></div>
					<div class="pager">
					<span id="total"><?php $pager->drawResults($totalItems);?></span>
					<span id="pager"><?php $pager->drawPager($totalItems, $videoPageSize, $page);?></span>
					<div style="clear:both"></div>
				</div>
				<div style="clear:both"></div>
			</div>
			<?php include '../include/webfooter.php';?>
		</div>
		<script type="text/javascript">
			$(function(){
				$('.myCorner').corner();
			});
		</script>
	</body>
</html>
